<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">
		<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
		<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../../JS/common.js"></script>
		<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
		<script type="text/javascript" src='../../../JS/detailView.js'></script>
	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'center'">
				<div>
					<table id="dg" style="width:100%;height:250px" singleSelect="true" fitColumns="true">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
		<div id="dlg" class="easyui-dialog" closed="true" style="width:760px;height:560px;padding:0px">
			<iframe id="ifrmEdit" height="100%" width="100%" frameborder="0" scrolling="no"></iframe>
		</div>
	</body>
	<script>
		var auth = "admin;" + hex_sha1("admin1");
		var data = {"icon": "icon-redo","func": "newdata()","functionname": "生成入库单"};
		content = "<a href=\"javascript:void(0)\" class=\"easyui-linkbutton\"  iconCls=\"" + data.icon + "\" plain='true' onclick=\"" + data.func + "\">" + data.functionname + "</a>";
		content += AddToolBar(32);
		$('#toolbar').append(content);
		$('#dg').datagrid({
			url: RemoteLinkAddress + '/logistics/purchaseorder/list.do?ISVERIFY=1',
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			rownumbers: 'true',
			autoRowHeight: 'true',
			fitColumns: 'false',
			height: 350,
			/*表格中的列名以及各自列名的ID*/
			columns: [
				[{
					field: 'ID',
					title: '采购单ID',
					width: '10%',
					align: 'center',

				}, {
					field: 'ORDER_NO',
					title: '采购单编号',
					width: '14%',
					align: 'center',

				}, {
					field: 'PURCHASE_MAN',
					title: '*采购员',
					width: '10%',
					align: 'center',

				}, {
					field: 'PURCHASE_DATE',
					title: '*采购时间',
					width: '14%',
					align: 'center',

				}, 
				{
					field: 'CREATE_TIME',
					title: '*建单时间',
					width: '14%',
					align: 'center',

				},{
					field: "STOREHOUSE_NAME",
					title: '仓库名',
					width: '15%',
					align: 'center',
				},
				{
					field:"STATE",
					title:'订单状态',
					width:'18%',
					align:'center',
				}
				]
			],
			onDblClickRow: function(index, row) {
				addWHI();
			}
		});
		function newdata(){
			addWHI();
		}
		function redodata(){
			var _url = RemoteLinkAddress + '/logistics/purchaseorder/list.do?ISVERIFY=1';
			$.ajax({
				dataType:"json",
				type:"get",
				url:_url,
				success: function(result) {
					if(result != null) {
						var _data = result;
						$('#dg').datagrid('loadData', _data);
					}
				}, 
				error: function(xhr, status, error) {
					$.messager.alert("错误", "请求失败!");
				}
			});
		}
		function addWHI(){
			var row = $("#dg").datagrid("getSelected");
			if(!row){
				$.messager.alert("警告","没有选中数据");
			}else{
				var pLocation = "";
				pLocation = "UI/LOGISTICS/WareHouseSchedule/WareHouseScheduleDetail.html?id=" + row.ID; /*将BoothManagementAdd.html的相对路径与被选中行的ID赋值给pLocation*/
				AddTabIn("采购单入库情况", parent.parent.$("#tabs"), pLocation);
			}
		}
	</script>

</html>